﻿namespace Blaze.ConfigExportTool.Exceptions
{
    using System.IO;
    using System.Text;
    using Aspose.Cells;

    /// <summary>
    /// 导出异常：单元格配置错误。
    /// </summary>
    public class CellException : ExportException
    {
        public CellException(Cell cell, string message)
            : base(null)
        {
            mCell = cell;
            mMessage = message;
        }

        protected override void AppendDetailMessage(StringBuilder buffer)
        {
            buffer.AppendLine(mMessage);
            buffer.AppendFormat("{0} {1} {2}\r\n", mCell.Name, mCell.DisplayStringValue, Path.GetFileName(mCell.Worksheet.Workbook.FileName));
        }

        private readonly Cell mCell;

        private readonly string mMessage;
    }
}